package com.netease.pris.activity;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.a.i;
import com.netease.pris.a.m;
import com.netease.pris.activity.a.s;
import com.netease.pris.activity.view.FlingGallery;
import com.netease.pris.activity.view.ap;
import com.netease.pris.activity.view.f;
import com.netease.pris.app.PrisApp;
import com.netease.pris.atom.u;
import com.netease.pris.c.l;
import com.netease.pris.v;
import java.util.LinkedList;

public class ArticleGalleryActivity extends ActivityEx
  implements ap, com.netease.pris.activity.view.ca
{
  public static int A = 0;
  public static int B = 0;
  public static int C = 0;
  public static int D = 0;
  public static int E = 0;
  private static final String J = "ArticleGalleryActivity";
  private static final boolean K = false;
  private static u W;
  public static final String a = "url";
  public static final String b = "nexturl";
  public static final String c = "title";
  public static final String d = "position";
  public static final String e = "operation";
  public static final String f = "type";
  public static final String g = "custom_type";
  public static int h = 4096;
  public static int i = 1 + h;
  public static int j = 2 + h;
  public static int k = 3 + h;
  public static int l = 4 + h;
  public static int m = 5 + h;
  public static int n = 6 + h;
  public static int o = 7 + h;
  public static int p = 8 + h;
  public static int q = 9 + h;
  public static int r = 10 + h;
  public static int s = 11 + h;
  public static int t = 12 + h;
  public static int u = 13 + h;
  public static int v = 14 + h;
  public static int w = 15 + h;
  public static int x = 16 + h;
  public static int y = 17 + h;
  public static int z = 18 + h;
  DialogInterface.OnClickListener F = new ca(this);
  View.OnClickListener G = new cb(this);
  TextWatcher H = new cc(this);
  com.netease.pris.b I = new cd(this);
  private FlingGallery L;
  private boolean M = false;
  private boolean N = false;
  private boolean O = false;
  private boolean P = false;
  private int Q = 0;
  private int R = 0;
  private String S = null;
  private String T = null;
  private int U;
  private com.netease.pris.atom.b V = com.netease.pris.atom.b.a;
  private LinkedList X;
  private com.netease.pris.protocol.d Y = null;
  private Context Z = null;
  private InputMethodManager aa = null;
  private LinearLayout ab = null;
  private LinearLayout ac = null;
  private LinearLayout ad = null;
  private EditText ae = null;
  private Button af = null;
  private CheckBox ag = null;
  private ImageButton ah = null;
  private ImageButton ai = null;
  private ImageButton aj = null;
  private ImageButton ak = null;
  private ImageButton al = null;
  private ViewGroup am;
  private cn an;
  private cn ao;

  static
  {
    A = 19 + h;
    B = 20 + h;
    C = 21 + h;
    D = 22 + h;
    E = 23 + h;
  }

  private void a(int paramInt, float paramFloat1, float paramFloat2)
  {
    m localm = new m(paramFloat1, paramFloat2, this.am.getWidth() / 2.0F, this.am.getHeight() / 2.0F, 0.0F, true);
    localm.setDuration(500L);
    localm.setFillAfter(true);
    localm.setInterpolator(new AccelerateInterpolator());
    localm.setAnimationListener(new j(this, paramInt, null));
    this.am.startAnimation(localm);
  }

  private void a(int paramInt, Object paramObject, String paramString1, String paramString2, boolean paramBoolean)
  {
    switch (paramInt)
    {
    default:
    case 903:
    }
    while (true)
    {
      return;
      this.R = v.a().a(paramString1, this.V, W);
      this.X.add(new Integer(this.R));
    }
  }

  public static void a(Context paramContext, String paramString1, String paramString2, int paramInt1, int paramInt2)
  {
    a(paramContext, paramString1, paramString2, paramInt1, paramInt2, com.netease.pris.atom.b.a);
  }

  public static void a(Context paramContext, String paramString1, String paramString2, int paramInt1, int paramInt2, com.netease.pris.atom.b paramb)
  {
    Intent localIntent = new Intent(paramContext, ArticleGalleryActivity.class);
    localIntent.putExtra("url", paramString1);
    localIntent.putExtra("title", paramString2);
    localIntent.putExtra("position", paramInt1);
    localIntent.putExtra("operation", paramInt2);
    if (paramb != null)
      localIntent.putExtra("custom_type", paramb.name());
    paramContext.startActivity(localIntent);
  }

  public static void a(u paramu)
  {
  }

  private void a(com.netease.pris.protocol.d paramd)
  {
    if ((paramd == null) || (paramd.h == null))
      return;
    if ((this.Y != null) && (this.Y.h != null))
    {
      i.a(paramd.h, this.Y.h);
      this.Y.h.addAll(paramd.h);
      if (this.Q <= this.L.l())
        break label160;
    }
    label160: for (this.Q = this.L.l(); ; this.Q = (1 + this.Q))
    {
      if (this.Q >= this.Y.h.size())
        this.Q = (-1 + this.Y.h.size());
      this.L.a(new s(this, this.U, this.V, this.T, this.Y, this.S, true), this.Q);
      break;
      break;
    }
  }

  private void b(int paramInt)
  {
    if (1 == paramInt)
      a(1, 0.0F, 90.0F);
    while (true)
    {
      return;
      if (paramInt == 0)
      {
        a(-1, 0.0F, 90.0F);
        continue;
      }
    }
  }

  private void b(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.ab.setVisibility(0);
      this.ad.setVisibility(8);
      this.ac.setVisibility(0);
    }
    while (true)
    {
      return;
      this.ab.setVisibility(8);
    }
  }

  private void c()
  {
    this.am = ((ViewGroup)findViewById(2131558400));
    this.ac = ((LinearLayout)this.ab.findViewById(2131558467));
    this.ad = ((LinearLayout)this.ab.findViewById(2131558471));
    this.ae = ((EditText)this.ab.findViewById(2131558468));
    this.af = ((Button)this.ab.findViewById(2131558469));
    this.ag = ((CheckBox)this.ab.findViewById(2131558470));
    this.ah = ((ImageButton)this.ab.findViewById(2131558473));
    this.ai = ((ImageButton)this.ab.findViewById(2131558475));
    this.aj = ((ImageButton)this.ab.findViewById(2131558477));
    this.ak = ((ImageButton)this.ab.findViewById(2131558481));
    this.al = ((ImageButton)this.ab.findViewById(2131558479));
  }

  private void c(boolean paramBoolean)
  {
    if (paramBoolean)
      this.ab.setVisibility(8);
    while (true)
    {
      PRISActivitySetting.d(this.Z, paramBoolean);
      IBinder localIBinder = this.ae.getWindowToken();
      this.aa.hideSoftInputFromWindow(localIBinder, 0);
      return;
      this.ab.setVisibility(0);
      this.ad.setVisibility(0);
      this.ac.setVisibility(8);
    }
  }

  private void e()
  {
    int i1 = com.netease.image.c.a(this.Z, 8.0F);
    ((LinearLayout)findViewById(2131558405)).setPadding(0, i1 / 2, i1, 0);
    k();
  }

  private void f()
  {
    if (this.ae != null)
      this.ae.addTextChangedListener(this.H);
    if (this.aj != null)
      this.aj.setOnClickListener(this.G);
    if (this.ah != null)
      this.ah.setOnClickListener(this.G);
    if (this.ai != null)
      this.ai.setOnClickListener(this.G);
    if (this.ak != null)
      this.ak.setOnClickListener(this.G);
    if (this.al != null)
      this.al.setOnClickListener(this.G);
    if (this.af != null)
      this.af.setOnClickListener(this.G);
  }

  private void g()
  {
    if (this.L == null);
    while (true)
    {
      return;
      if (this.L.l() == this.L.i())
      {
        if (this.P)
          continue;
        if (this.S != null)
        {
          this.P = true;
          this.Q = this.L.l();
          a(903, null, this.S, null, true);
          com.netease.l.b.b.a(this.Z, 2131361949);
          continue;
        }
        com.netease.l.b.b.a(this.Z, 2131361939);
        continue;
      }
      this.L.o();
    }
  }

  private void h()
  {
    if (this.L == null);
    while (true)
    {
      return;
      if (this.L.l() == this.L.h())
      {
        com.netease.l.b.b.a(this.Z, 2131361938);
        continue;
      }
      this.L.n();
    }
  }

  public Object a(int paramInt1, int paramInt2, Object paramObject)
  {
    if (this.L != null);
    for (Object localObject = this.L.b(-1, paramInt2, paramObject); ; localObject = null)
      return localObject;
  }

  public void a()
  {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setTitle(2131361927);
    cn localcn = PRISActivitySetting.g(this.Z);
    this.an = localcn;
    this.ao = localcn;
    localBuilder.setSingleChoiceItems(2131165190, PRISActivitySetting.a(localcn), this.F);
    by localby = new by(this);
    localBuilder.setPositiveButton(17039370, localby);
    localBuilder.setNegativeButton(17039360, localby);
    AlertDialog localAlertDialog = localBuilder.create();
    localAlertDialog.setCancelable(false);
    localAlertDialog.show();
  }

  public void a(int paramInt)
  {
    this.ae.setText(null);
    Object localObject = a(-1, E, null);
    if (localObject != null)
      com.netease.pris.d.c.a(p(), 1743, (String)localObject);
    while (true)
    {
      return;
      com.netease.pris.d.c.a(p(), 1743);
    }
  }

  public void a(MotionEvent paramMotionEvent)
  {
    Object localObject = a(-1, B, null);
    if (localObject == null);
    while (true)
    {
      return;
      if (((Boolean)localObject).booleanValue())
      {
        Integer localInteger = (Integer)a(-1, u, null);
        if (((localInteger != null) && (localInteger.intValue() != 0)) || (!((Boolean)a(-1, A, null)).booleanValue()))
          continue;
        f localf = new f(this);
        localf.a(1, 2131362310);
        localf.a(new bz(this));
        localf.a(this.L, (int)paramMotionEvent.getX(), (int)paramMotionEvent.getY(), 0);
        continue;
      }
    }
  }

  public int b()
  {
    if (this.L != null);
    for (int i1 = this.L.m(); ; i1 = -1)
      return i1;
  }

  public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
  {
    if (4 != paramKeyEvent.getKeyCode());
    while (true)
    {
      return super.dispatchKeyEvent(paramKeyEvent);
      IBinder localIBinder = this.ae.getWindowToken();
      this.aa.hideSoftInputFromWindow(localIBinder, 0);
    }
  }

  public void finish()
  {
    Intent localIntent = new Intent();
    Bundle localBundle = new Bundle();
    localBundle.putInt("position", this.L.l());
    localBundle.putString("nexturl", this.S);
    localIntent.putExtras(localBundle);
    setResult(-1, localIntent);
    super.finish();
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    switch (paramInt1)
    {
    default:
    case 4096:
    }
    while (true)
    {
      return;
      if ((paramInt2 == -1) && (paramIntent != null))
      {
        Bundle localBundle = paramIntent.getExtras();
        if (localBundle == null)
          continue;
        int i1 = localBundle.getInt("position");
        this.S = localBundle.getString("nexturl");
        if (i1 == this.Q)
          continue;
        this.Q = i1;
        if (this.L == null)
          continue;
        this.L.d(this.Q);
        continue;
      }
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    com.netease.image.d.a().e();
    this.L = new FlingGallery(this);
    this.L.b(true);
    this.L.a(this);
    this.L.a(this);
    this.L.a(new fk(this));
    this.L.a(new fj(this));
    this.L.b(200);
    this.L.setBackgroundColor(k.a(this).c(2131230884));
    LinearLayout localLinearLayout = new LinearLayout(this);
    localLinearLayout.setOrientation(1);
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, 0);
    localLayoutParams.weight = 1.0F;
    localLinearLayout.addView(this.L, localLayoutParams);
    this.ab = ((LinearLayout)LayoutInflater.from(this).inflate(2130903063, null));
    localLinearLayout.addView(this.ab, new LinearLayout.LayoutParams(-1, -2));
    setContentView(localLinearLayout);
    this.Q = 0;
    Intent localIntent = getIntent();
    if (localIntent != null)
    {
      this.S = localIntent.getStringExtra("nexturl");
      this.T = localIntent.getStringExtra("title");
      this.Q = localIntent.getIntExtra("position", 0);
      this.U = localIntent.getIntExtra("operation", 256);
      String str = localIntent.getStringExtra("custom_type");
      if (str != null)
        this.V = com.netease.pris.atom.b.valueOf(str);
    }
    if (this.V != com.netease.pris.atom.b.a)
    {
      this.ab.findViewById(2131558478).setVisibility(8);
      this.ab.findViewById(2131558476).setVisibility(8);
    }
    this.Z = this;
    this.X = new LinkedList();
    this.M = PRISActivitySetting.d(this.Z);
    this.O = PRISActivitySetting.h(this.Z);
    this.aa = ((InputMethodManager)getSystemService("input_method"));
    c();
    e();
    f();
    c(true);
    this.Y = PrisApp.a().p();
    if ((this.Y != null) && (this.Y.h != null) && (this.Y.h.size() > 0))
      this.L.a(new s(this, this.U, this.V, this.T, this.Y, this.S, false), this.Q);
    v.a().a(this.I);
  }

  public void onDestroy()
  {
    com.netease.l.b.b.a();
    super.onDestroy();
    v.a().b(this.I);
    if (this.I != null)
    {
      this.I.c();
      this.I = null;
    }
    if (this.L != null)
    {
      this.L.a(0, v, Boolean.valueOf(true));
      this.L.a(1, v, Boolean.valueOf(true));
      this.L.a(2, v, Boolean.valueOf(true));
      this.L.f();
      this.L = null;
    }
    if (this.X != null)
      this.X.clear();
    this.S = null;
    this.T = null;
    this.am = null;
    this.Z = null;
    this.Y = null;
    System.gc();
  }

  // ERROR //
  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_3
    //   2: iconst_4
    //   3: iload_1
    //   4: if_icmpne +57 -> 61
    //   7: aload_0
    //   8: bipush 255
    //   10: getstatic 141	com/netease/pris/activity/ArticleGalleryActivity:u	I
    //   13: aconst_null
    //   14: invokevirtual 549	com/netease/pris/activity/ArticleGalleryActivity:a	(IILjava/lang/Object;)Ljava/lang/Object;
    //   17: ifnull +155 -> 172
    //   20: iconst_1
    //   21: aload_0
    //   22: bipush 255
    //   24: getstatic 141	com/netease/pris/activity/ArticleGalleryActivity:u	I
    //   27: aconst_null
    //   28: invokevirtual 549	com/netease/pris/activity/ArticleGalleryActivity:a	(IILjava/lang/Object;)Ljava/lang/Object;
    //   31: checkcast 304	java/lang/Integer
    //   34: invokevirtual 571	java/lang/Integer:intValue	()I
    //   37: if_icmpne +129 -> 166
    //   40: aload_0
    //   41: iconst_0
    //   42: invokespecial 342	com/netease/pris/activity/ArticleGalleryActivity:b	(I)V
    //   45: aload_0
    //   46: invokevirtual 551	com/netease/pris/activity/ArticleGalleryActivity:p	()Ljava/lang/String;
    //   49: sipush 1733
    //   52: invokestatic 561	com/netease/pris/d/c:a	(Ljava/lang/String;I)V
    //   55: iconst_1
    //   56: istore 6
    //   58: goto +111 -> 169
    //   61: bipush 24
    //   63: iload_1
    //   64: if_icmpne +29 -> 93
    //   67: aload_0
    //   68: getfield 166	com/netease/pris/activity/ArticleGalleryActivity:M	Z
    //   71: ifeq +101 -> 172
    //   74: aload_0
    //   75: invokespecial 453	com/netease/pris/activity/ArticleGalleryActivity:h	()V
    //   78: aload_0
    //   79: invokevirtual 551	com/netease/pris/activity/ArticleGalleryActivity:p	()Ljava/lang/String;
    //   82: sipush 1729
    //   85: invokestatic 561	com/netease/pris/d/c:a	(Ljava/lang/String;I)V
    //   88: iconst_1
    //   89: istore_3
    //   90: goto +82 -> 172
    //   93: bipush 25
    //   95: iload_1
    //   96: if_icmpne +29 -> 125
    //   99: aload_0
    //   100: getfield 166	com/netease/pris/activity/ArticleGalleryActivity:M	Z
    //   103: ifeq +69 -> 172
    //   106: aload_0
    //   107: invokespecial 466	com/netease/pris/activity/ArticleGalleryActivity:g	()V
    //   110: aload_0
    //   111: invokevirtual 551	com/netease/pris/activity/ArticleGalleryActivity:p	()Ljava/lang/String;
    //   114: sipush 1729
    //   117: invokestatic 561	com/netease/pris/d/c:a	(Ljava/lang/String;I)V
    //   120: iconst_1
    //   121: istore_3
    //   122: goto +50 -> 172
    //   125: iconst_4
    //   126: iload_1
    //   127: if_icmpne +45 -> 172
    //   130: iconst_1
    //   131: istore_3
    //   132: goto +40 -> 172
    //   135: astore 4
    //   137: aload 4
    //   139: invokevirtual 799	java/lang/NullPointerException:printStackTrace	()V
    //   142: iload_3
    //   143: istore 5
    //   145: goto +30 -> 175
    //   148: aload_0
    //   149: iload_1
    //   150: aload_2
    //   151: invokespecial 801	com/netease/framework/ActivityEx:onKeyDown	(ILandroid/view/KeyEvent;)Z
    //   154: istore 5
    //   156: goto +24 -> 180
    //   159: astore 4
    //   161: iconst_1
    //   162: istore_3
    //   163: goto -26 -> 137
    //   166: iconst_0
    //   167: istore 6
    //   169: iload 6
    //   171: istore_3
    //   172: iload_3
    //   173: istore 5
    //   175: iload 5
    //   177: ifeq -29 -> 148
    //   180: iload 5
    //   182: ireturn
    //
    // Exception table:
    //   from	to	target	type
    //   7	78	135	java/lang/NullPointerException
    //   99	110	135	java/lang/NullPointerException
    //   78	88	159	java/lang/NullPointerException
    //   110	120	159	java/lang/NullPointerException
  }

  public boolean onKeyUp(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool = true;
    if (24 == paramInt)
      if (!this.M)
        break label30;
    while (true)
    {
      return bool;
      if ((25 == paramInt) && (this.M))
        continue;
      label30: bool = super.onKeyUp(paramInt, paramKeyEvent);
    }
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    int i1 = 1;
    int i2 = paramMenuItem.getItemId();
    Object localObject = a(-1, E, null);
    switch (i2)
    {
    default:
    case 2131558715:
    case 2131558720:
    case 2131558717:
    case 2131558718:
    case 2131558721:
    case 2131558716:
    case 2131558719:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      label101: String str1;
      if (this.N)
      {
        if (this.L != null)
          this.L.a(-1, j, Integer.valueOf(0));
        str1 = p();
        if (this.N)
          break label160;
        label114: if (localObject != null)
          break label165;
      }
      label160: label165: for (String str2 = null; ; str2 = (String)localObject)
      {
        com.netease.pris.d.c.a(str1, i1, str2);
        break;
        if (this.L == null)
          break label101;
        this.L.a(-1, i, Integer.valueOf(0));
        break label101;
        i1 = 0;
        break label114;
      }
      if (this.L != null)
        this.L.a(-1, l, Integer.valueOf(0));
      if (localObject == null)
      {
        com.netease.pris.d.c.a(p(), 1740);
        continue;
      }
      com.netease.pris.d.c.a(p(), 1740, (String)localObject);
      continue;
      if (this.L != null)
        this.L.a(-1, x, Integer.valueOf(0));
      if (localObject == null)
      {
        com.netease.pris.d.c.a(p(), 1742);
        continue;
      }
      com.netease.pris.d.c.a(p(), 1742, (String)localObject);
      continue;
      a();
      com.netease.pris.d.c.a(p(), 706);
      continue;
      if (this.L != null)
        this.L.a(-1, n, Integer.valueOf(0));
      if (localObject == null)
      {
        com.netease.pris.d.c.a(p(), 1741);
        continue;
      }
      com.netease.pris.d.c.a(p(), 1741, (String)localObject);
      continue;
      if (((Integer)a(-1, u, null)).intValue() == 0);
      int i4;
      for (int i3 = i1; ; i4 = 0)
      {
        b(i3);
        com.netease.pris.d.c.a(p(), 1731);
        break;
      }
      if (this.L == null)
        continue;
      this.L.a(-1, m, Integer.valueOf(0));
    }
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    paramMenu.clear();
    getMenuInflater().inflate(2131492864, paramMenu);
    Object localObject1 = a(-1, k, null);
    Object localObject2;
    if (localObject1 == null)
    {
      paramMenu.findItem(2131558715).setEnabled(false);
      if (a(-1, x, null) == null)
        paramMenu.findItem(2131558717).setEnabled(false);
      if (a(-1, l, null) == null)
        paramMenu.findItem(2131558720).setEnabled(false);
      localObject2 = a(-1, u, null);
      if (localObject2 != null)
        break label271;
      paramMenu.findItem(2131558716).setEnabled(false);
    }
    while (true)
    {
      if (a(-1, n, null) == null)
        paramMenu.findItem(2131558721).setEnabled(false);
      if (this.V != com.netease.pris.atom.b.a)
      {
        paramMenu.removeItem(2131558715);
        paramMenu.removeItem(2131558716);
        paramMenu.removeItem(2131558720);
      }
      return super.onPrepareOptionsMenu(paramMenu);
      this.N = ((Boolean)localObject1).booleanValue();
      if (this.N)
      {
        paramMenu.findItem(2131558715).setTitle(2131361916);
        break;
      }
      paramMenu.findItem(2131558715).setTitle(2131361915);
      break;
      label271: if (((Integer)localObject2).intValue() == 1)
      {
        paramMenu.findItem(2131558716).setTitle(2131361919);
        paramMenu.findItem(2131558716).setIcon(2130837647);
        continue;
      }
      paramMenu.findItem(2131558716).setTitle(2131361918);
      paramMenu.findItem(2131558716).setIcon(2130837649);
    }
  }

  protected void onResume()
  {
    int i1 = l.c(this);
    CheckBox localCheckBox = this.ag;
    if (i1 > 0);
    for (int i2 = 0; ; i2 = 8)
    {
      localCheckBox.setVisibility(i2);
      super.onResume();
      return;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.ArticleGalleryActivity
 * JD-Core Version:    0.6.0
 */